package com.jdiv.samples.tutor2;

import com.jdiv.JDiv;
import com.jdiv.JProgram;
import com.jdiv.util.JNumber;

/**
 * @author  Joyal
 */
public class Main extends JProgram{
	
/**
 * @uml.property  name="planets"
 * @uml.associationEnd  
 */
public JNumber planets=new JNumber(0);

 public Main(){
	 
	JDiv.set_mode(JDiv.m320x200);
	// Loads graphics' file
    JDiv.load_fpg("res/fpg/tutor2.fpg");
    // Sets the number of frames per second
    //set_fps(24,0);
    // Puts background screen
    JDiv.put_screen(1,41);
    // Writes an explanable message
    JDiv.write(0,160,2,1,"Press space bar to create planets");
    
    //numbers of planets
   JDiv.write(0,3,15,0,"Planets:");
   JDiv.write(0,50,15,0,planets);
    
    // Creates an endless loop, since no process has been created yet,
    // and program will end if this loop didn't exist
     
          
 }

 public void loop(){
	        // Each time the space key is pressed, an earth type
	        // process is created
	        if (JDiv.key(JDiv._SPACE)){
	        	new Earth();
	        	planets.setNum(planets.getNum()+1);
	        }
	   
 }

 public static void main(String args[]){
		Main m=new Main();
	}
 
}
